package special;

import java.util.LinkedList;

class DataStream {
    int value = 0;
    int count = 0;
    int size = 0;
    LinkedList<Integer> list = new LinkedList<>();
    public DataStream(int value, int k) {
        list = new LinkedList<>();
        size = k;
        this.value = value;
    }
    
    public boolean consec(int num) {
        if (list.size() >= size){
            Integer first = list.removeFirst();
            count -= first == value ? 1 : 0;
        }
        count += num == value ? 1 : 0;
        list.addLast(num);
        return count == size;
    }
}